package com.hntest.entity;

import org.apache.ibatis.annotations.Param;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

public class Student implements Serializable {
    private static final long serialVersionUID = 6288382782121956228L;
    private Integer sno;
    private String sname;
    @DateTimeFormat(pattern="yyyy-MM-dd")//页面输入日期时，可以根据该格式自动进行类型转换
    private Date birthdate;
    private String spass;
    private Grade grade;

    public Student() {
    }

    public Student(Integer sno, String sname, Date birthdate, String spass, Grade grade) {
        this.sno = sno;
        this.sname = sname;
        this.birthdate = birthdate;
        this.spass = spass;
        this.grade = grade;
    }

    @Override
    public String toString() {
        return "Student{" +
                "sno=" + sno +
                ", sname='" + sname + '\'' +
                ", birthdate=" + birthdate +
                ", spass='" + spass + '\'' +
                ", gradeID=" + grade.getGid() +
                ", gradeName=" + grade.getGname() +
                '}';
    }

    public Integer getSno() {
        return sno;
    }

    public void setSno(Integer sno) {
        this.sno = sno;
    }

    public String getSname() {
        return sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    public Date getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    public String getSpass() {
        return spass;
    }

    public void setSpass(String spass) {
        this.spass = spass;
    }

    public Grade getGrade() {
        return grade;
    }

    public void setGrade(Grade grade) {
        this.grade = grade;
    }
}
